Skip to content

add config param 'renew'#265

Closed
mikhail-angelov wants to merge 4 commits intoocombe:masterfrom
mikhail-angelov:master
Closed

add config param 'renew'#265
mikhail-angelov wants to merge 4 commits intoocombe:masterfrom
mikhail-angelov:master

Conversation

@mikhail-angelov
Copy link

Hi
Sometime It's needed to reload dynamic modules and initialize them properly
there are 2 useful params for it: rerun, reconfig
It will be nice to add one more (e.g. renew), which force to register module components

BR
Mikhail

…ntrollers, services, etc..) once module is reloaded
@ocombe
Copy link
Owner

ocombe commented Nov 7, 2015

Hmm are you sure that it works ?
Don't you think that it could have disastrous effect if you reset components that have might be used by the application ?

@mikhail-angelov
Copy link
Author

it's working at least in my case:
I'm making application, which load modules dynamically depend on login user
I do not like reset browser page on logout, so I reset angular contact (remove dom element connected with angular) and compose new angular content again.

here I faced with problem, since ocLazyLoad is not reloaded it keeps state, even if all angular app content is gone, and I did not find a way how to reset ocLazyLoad and make it properly init dynamic modules (it thinks all services and controllers already loaded, and does not register them any more)
since you already have similar params (reconfig, rerun) which help to solve similar issue, I thought one more will be ok

I agree it may cause unexpected behavior if application content was not reset
so it should be used responsibly :)

@ocombe
Copy link
Owner

ocombe commented Nov 7, 2015

Then maybe we should offer a way to reset the internal arrays of ocLazyLoad instead ?

@mikhail-angelov
Copy link
Author

yes, it will work as well.
we need just clean regInvokes map
I can prepare such solution

@ocombe
Copy link
Owner

ocombe commented Nov 7, 2015

Yeah, that would be better, and we could use it in the unit tests as well

@mikhail-angelov
Copy link
Author

pull request is updated, but I'm not sure the solution is better than previous one
I did not manage to make unit test for it, because this function update internal state, which is not visible via API (

@ocombe ocombe closed this in 5aba0dc Nov 24, 2015
@ocombe
Copy link
Owner

ocombe commented Nov 24, 2015

I copied your code and rewrote the commit because you were bumping the version in your commit.
Thanks for the PR, it's available on master.

@mikhail-angelov
Copy link
Author

ok, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants